<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>miniFOC: system/gd32f1x0_it.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectlogo"><img alt="Logo" src="Acme_LOGO.png"/></td>
  <td id="projectalign">
   <div id="projectname">miniFOC<span id="projectnumber">&#160;1.0.3</span>
   </div>
   <div id="projectbrief">This open-source project aims to accomplish a FOC(Field Oriented Control) scheme that is operatable with minimum costs in China.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_262ef3e34820216e073ea116856421e0.html">system</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle"><div class="title">gd32f1x0_it.c</div></div>
</div><!--header-->
<div class="contents">
<a href="gd32f1x0__it_8c.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span><span class="comment">/**************************************************************************/</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span><span class="preprocessor">#include &quot;<a class="code" href="gd32f1x0__it_8h.html">gd32f1x0_it.h</a>&quot;</span></div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span><span class="preprocessor">#include &quot;<a class="code" href="main_8h.html">main.h</a>&quot;</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span> </div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#abb5e2753d967e52e57ddb82924eb5cf7">   16</a></span><span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code hl_variable" href="gd32f1x0__it_8c.html#abb5e2753d967e52e57ddb82924eb5cf7">systick_counter</a> = 0;</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno">   17</span> </div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a6ad7a5e3ee69cb6db6a6b9111ba898bc">   21</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a6ad7a5e3ee69cb6db6a6b9111ba898bc">NMI_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span>}</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span> </div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a2bffc10d5bd4106753b7c30e86903bea">   27</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a2bffc10d5bd4106753b7c30e86903bea">HardFault_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno">   28</span>    <span class="comment">/* if Hard Fault exception occurs, go to infinite loop */</span></div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno">   29</span>    <span class="keywordflow">while</span> (1);</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno">   30</span>}</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno">   31</span> </div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a3150f74512510287a942624aa9b44cc5">   35</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a3150f74512510287a942624aa9b44cc5">MemManage_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno">   36</span>    <span class="comment">/* if Memory Manage exception occurs, go to infinite loop */</span></div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno">   37</span>    <span class="keywordflow">while</span> (1);</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno">   38</span>}</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno">   39</span> </div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a850cefb17a977292ae5eb4cafa9976c3">   43</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a850cefb17a977292ae5eb4cafa9976c3">BusFault_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span>    <span class="comment">/* if Bus Fault exception occurs, go to infinite loop */</span></div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span>    <span class="keywordflow">while</span> (1);</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno">   46</span>}</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno">   47</span> </div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a1d98923de2ed6b7309b66f9ba2971647">   51</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a1d98923de2ed6b7309b66f9ba2971647">UsageFault_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno">   52</span>    <span class="comment">/* if Usage Fault exception occurs, go to infinite loop */</span></div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno">   53</span>    <span class="keywordflow">while</span> (1);</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno">   54</span>}</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno">   55</span> </div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a3e5ddb3df0d62f2dc357e64a3f04a6ce">   59</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a3e5ddb3df0d62f2dc357e64a3f04a6ce">SVC_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno">   60</span>}</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno">   61</span> </div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#adbdfb05858cc36fc520974df37ec3cb0">   65</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#adbdfb05858cc36fc520974df37ec3cb0">DebugMon_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno">   66</span>}</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno">   67</span> </div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a6303e1f258cbdc1f970ce579cc015623">   71</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a6303e1f258cbdc1f970ce579cc015623">PendSV_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno">   72</span>}</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span> </div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#ab5e09814056d617c521549e542639b7e">   77</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#ab5e09814056d617c521549e542639b7e">SysTick_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno">   78</span>    <span class="comment">/* update millisecond delay counter */</span></div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno">   79</span>    <a class="code hl_function" href="system_8c.html#a713199ab95f480628d6658708ed8de8b">delay_decrement</a>();</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno">   80</span>    <a class="code hl_variable" href="gd32f1x0__it_8c.html#abb5e2753d967e52e57ddb82924eb5cf7">systick_counter</a>++;</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno">   81</span> </div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno">   82</span>    <span class="comment">/* reduce the frequency to SPEED_UP_FREQ, update the current rotor speed */</span></div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno">   83</span>    <span class="keywordflow">if</span> (<a class="code hl_variable" href="gd32f1x0__it_8c.html#abb5e2753d967e52e57ddb82924eb5cf7">systick_counter</a> == (1000 / <a class="code hl_define" href="config_8h.html#adddd943909a2fac22c5fe8e3949d105f">SPEED_UP_FREQ</a>)) {</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno">   84</span>        <a class="code hl_variable" href="gd32f1x0__it_8c.html#abb5e2753d967e52e57ddb82924eb5cf7">systick_counter</a> = 0;</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno">   85</span>        <a class="code hl_function" href="encoder_8c.html#a82c51d78a1f7bb4a5976974ab8d7ffe5">encoder_update_speed</a>();</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno">   86</span>    }</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno">   87</span>}</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno">   88</span> </div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#aa521223328872dd7e4cd659fecbdfb84">   92</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#aa521223328872dd7e4cd659fecbdfb84">USART0_IRQHandler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno">   93</span>    <span class="comment">/* judge whether a reception interrupt is generated */</span></div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno">   94</span>    <span class="keywordflow">if</span> (RESET != usart_interrupt_flag_get(USART0, USART_INT_FLAG_RBNE)) {</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno">   95</span>        <span class="comment">/* receive, process and unzip data */</span></div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno">   96</span>        <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> rcv_data = usart_data_receive(USART0);</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno">   97</span>        <a class="code hl_function" href="uart_8c.html#a8b1fe807c1672229711abeb195185046">mdtp_receive_handler</a>(rcv_data);</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno">   98</span>    }</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno">   99</span>}</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno">  100</span> </div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a12c8b827e5eab9d3f93d56f858e735a3">  104</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a12c8b827e5eab9d3f93d56f858e735a3">TIMER2_IRQHandler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno">  105</span>    <span class="comment">/* judge whether a timer update interrupt is generated, clear timer interrupt flag bit */</span></div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno">  106</span>    <span class="keywordflow">if</span> (SET == timer_interrupt_flag_get(TIMER2, TIMER_INT_UP)) {</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno">  107</span>        timer_interrupt_flag_clear(TIMER2, TIMER_INT_UP);</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno">  108</span> </div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno">  109</span>        <span class="comment">/* obtain the electric angle at the current time */</span></div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno">  110</span>        <span class="keywordtype">float</span> u, v, w, angle = (float) <a class="code hl_function" href="encoder_8c.html#a8fbcb19c2f15c20c1a862e0cf64f6771">encoder_get_electronic_angle</a>();</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno">  111</span> </div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno">  112</span>        <span class="comment">/* Clarke inverse transform and SVPWM modulation */</span></div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno">  113</span>        <span class="keywordflow">if</span> (<a class="code hl_variable" href="foc_8c.html#ad335385ea3909d9485703d97735b34ca">phase_sequence</a> == 0)</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno">  114</span>            <a class="code hl_function" href="foc_8c.html#a2ee2669a464e17cfaab4e084e78c4fe1">foc_calculate_dutycycle</a>(angle, 0, <a class="code hl_variable" href="foc_8c.html#a6c9e1e8356380a4129a3a59d52ee1ec4">FOC_Struct</a>.<a class="code hl_variable" href="struct_f_o_c___structure__t.html#a483644b553c2be32ffbaf641f23c6cea">user_expect</a>, &amp;u, &amp;v, &amp;w);</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno">  115</span>        <span class="keywordflow">else</span></div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno">  116</span>            <a class="code hl_function" href="foc_8c.html#a2ee2669a464e17cfaab4e084e78c4fe1">foc_calculate_dutycycle</a>(angle, 0, <a class="code hl_variable" href="foc_8c.html#a6c9e1e8356380a4129a3a59d52ee1ec4">FOC_Struct</a>.<a class="code hl_variable" href="struct_f_o_c___structure__t.html#a483644b553c2be32ffbaf641f23c6cea">user_expect</a>, &amp;v, &amp;u, &amp;w);</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno">  117</span>        <a class="code hl_function" href="timer_8c.html#ab3614c1dcfba485b2e299839d9c189e4">update_pwm_dutycycle</a>(u, v, w);</div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno">  118</span>    }</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno">  119</span>}</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno">  120</span> </div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a94ca44d5889df2048bb8e52f7e2076e4">  124</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a94ca44d5889df2048bb8e52f7e2076e4">TIMER13_IRQHandler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno">  125</span>    <span class="comment">/* judge whether a timer update interrupt is generated, clear timer interrupt flag bit */</span></div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno">  126</span>    <span class="keywordflow">if</span> (SET == timer_interrupt_flag_get(TIMER13, TIMER_INT_UP)) {</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno">  127</span>        timer_interrupt_flag_clear(TIMER13, TIMER_INT_UP);</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno">  128</span> </div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno">  129</span>        <span class="comment">/* judge whether angle closed-loop control is required */</span></div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno">  130</span>        <span class="keywordflow">if</span> (<a class="code hl_variable" href="pid_8c.html#a2c7bcbec66fa40a2347b1cd253a5ae82">pid_control_mode_flag</a> == <a class="code hl_define" href="pid_8h.html#a7dad3a985101eaec7ac078f43747c928">ANGLE_LOOP_CONTROL</a>)</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno">  131</span>            <span class="comment">/* the calculated value of the angle loop is taken as the expected value of the speed loop */</span></div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno">  132</span>            <a class="code hl_variable" href="pid_8c.html#ab051c8f4a730b934b146f330514efd95">speed_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#ad0e13a810b1a4602c1ce625f9877cbf5">expect</a> =</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno">  133</span>                <a class="code hl_function" href="pid_8c.html#abe6a9dce63d0eaad5a10d4c8c5ffcd07">pid_calculate_result</a>((<a class="code hl_struct" href="struct_p_i_d___structure__t.html">PID_Structure_t</a> *) &amp;<a class="code hl_variable" href="pid_8c.html#aaa8f5bad87ffc78a20f06863ab6bad5c">angle_pid_handler</a>, <a class="code hl_variable" href="foc_8c.html#a6c9e1e8356380a4129a3a59d52ee1ec4">FOC_Struct</a>.<a class="code hl_variable" href="struct_f_o_c___structure__t.html#af832998676bd09b4198a7a7274072766">mechanical_angle</a>);</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno">  134</span> </div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno">  135</span>        <span class="comment">/* calculate the speed loop PID and obtain the calculated value */</span></div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno">  136</span>        <a class="code hl_variable" href="foc_8c.html#a6c9e1e8356380a4129a3a59d52ee1ec4">FOC_Struct</a>.<a class="code hl_variable" href="struct_f_o_c___structure__t.html#a483644b553c2be32ffbaf641f23c6cea">user_expect</a> = <a class="code hl_function" href="pid_8c.html#abe6a9dce63d0eaad5a10d4c8c5ffcd07">pid_calculate_result</a>((<a class="code hl_struct" href="struct_p_i_d___structure__t.html">PID_Structure_t</a> *) &amp;<a class="code hl_variable" href="pid_8c.html#ab051c8f4a730b934b146f330514efd95">speed_pid_handler</a>, <a class="code hl_variable" href="foc_8c.html#a6c9e1e8356380a4129a3a59d52ee1ec4">FOC_Struct</a>.<a class="code hl_variable" href="struct_f_o_c___structure__t.html#af32f899f7a231c9df64a594c7b13bfa4">rotate_speed</a>);</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno">  137</span>    }</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno">  138</span>}</div>
<div class="ttc" id="aconfig_8h_html_adddd943909a2fac22c5fe8e3949d105f"><div class="ttname"><a href="config_8h.html#adddd943909a2fac22c5fe8e3949d105f">SPEED_UP_FREQ</a></div><div class="ttdeci">#define SPEED_UP_FREQ</div><div class="ttdoc">set speed update frequency to 200Hz</div><div class="ttdef"><b>Definition:</b> <a href="config_8h_source.html#l00032">config.h:32</a></div></div>
<div class="ttc" id="aencoder_8c_html_a82c51d78a1f7bb4a5976974ab8d7ffe5"><div class="ttname"><a href="encoder_8c.html#a82c51d78a1f7bb4a5976974ab8d7ffe5">encoder_update_speed</a></div><div class="ttdeci">void encoder_update_speed(void)</div><div class="ttdoc">called every 2 milliseconds to calculate the speed.</div><div class="ttdef"><b>Definition:</b> <a href="encoder_8c_source.html#l00106">encoder.c:106</a></div></div>
<div class="ttc" id="aencoder_8c_html_a8fbcb19c2f15c20c1a862e0cf64f6771"><div class="ttname"><a href="encoder_8c.html#a8fbcb19c2f15c20c1a862e0cf64f6771">encoder_get_electronic_angle</a></div><div class="ttdeci">float encoder_get_electronic_angle(void)</div><div class="ttdoc">according to the electrical angle calculated from the mechanical angle, this function will call encod...</div><div class="ttdef"><b>Definition:</b> <a href="encoder_8c_source.html#l00093">encoder.c:93</a></div></div>
<div class="ttc" id="afoc_8c_html_a2ee2669a464e17cfaab4e084e78c4fe1"><div class="ttname"><a href="foc_8c.html#a2ee2669a464e17cfaab4e084e78c4fe1">foc_calculate_dutycycle</a></div><div class="ttdeci">void foc_calculate_dutycycle(float elect_angle, float d, float q, float *u, float *v, float *w)</div><div class="ttdoc">calculate the corresponding three-phase PWM duty cycle under the current electrical angle</div><div class="ttdef"><b>Definition:</b> <a href="foc_8c_source.html#l00099">foc.c:99</a></div></div>
<div class="ttc" id="afoc_8c_html_a6c9e1e8356380a4129a3a59d52ee1ec4"><div class="ttname"><a href="foc_8c.html#a6c9e1e8356380a4129a3a59d52ee1ec4">FOC_Struct</a></div><div class="ttdeci">volatile FOC_Structure_t FOC_Struct</div><div class="ttdoc">FOC handler.</div><div class="ttdef"><b>Definition:</b> <a href="foc_8c_source.html#l00020">foc.c:20</a></div></div>
<div class="ttc" id="afoc_8c_html_ad335385ea3909d9485703d97735b34ca"><div class="ttname"><a href="foc_8c.html#ad335385ea3909d9485703d97735b34ca">phase_sequence</a></div><div class="ttdeci">volatile unsigned char phase_sequence</div><div class="ttdoc">motor phase sequence flag variable</div><div class="ttdef"><b>Definition:</b> <a href="foc_8c_source.html#l00024">foc.c:24</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a12c8b827e5eab9d3f93d56f858e735a3"><div class="ttname"><a href="gd32f1x0__it_8c.html#a12c8b827e5eab9d3f93d56f858e735a3">TIMER2_IRQHandler</a></div><div class="ttdeci">void TIMER2_IRQHandler(void)</div><div class="ttdoc">this function handles TIMER2 TIMER_INT_UP interrupt request</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00104">gd32f1x0_it.c:104</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a1d98923de2ed6b7309b66f9ba2971647"><div class="ttname"><a href="gd32f1x0__it_8c.html#a1d98923de2ed6b7309b66f9ba2971647">UsageFault_Handler</a></div><div class="ttdeci">void UsageFault_Handler(void)</div><div class="ttdoc">this function handles UsageFault exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00051">gd32f1x0_it.c:51</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a2bffc10d5bd4106753b7c30e86903bea"><div class="ttname"><a href="gd32f1x0__it_8c.html#a2bffc10d5bd4106753b7c30e86903bea">HardFault_Handler</a></div><div class="ttdeci">void HardFault_Handler(void)</div><div class="ttdoc">this function handles HardFault exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00027">gd32f1x0_it.c:27</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a3150f74512510287a942624aa9b44cc5"><div class="ttname"><a href="gd32f1x0__it_8c.html#a3150f74512510287a942624aa9b44cc5">MemManage_Handler</a></div><div class="ttdeci">void MemManage_Handler(void)</div><div class="ttdoc">this function handles MemManage exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00035">gd32f1x0_it.c:35</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a3e5ddb3df0d62f2dc357e64a3f04a6ce"><div class="ttname"><a href="gd32f1x0__it_8c.html#a3e5ddb3df0d62f2dc357e64a3f04a6ce">SVC_Handler</a></div><div class="ttdeci">void SVC_Handler(void)</div><div class="ttdoc">this function handles SVC exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00059">gd32f1x0_it.c:59</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a6303e1f258cbdc1f970ce579cc015623"><div class="ttname"><a href="gd32f1x0__it_8c.html#a6303e1f258cbdc1f970ce579cc015623">PendSV_Handler</a></div><div class="ttdeci">void PendSV_Handler(void)</div><div class="ttdoc">this function handles PendSV exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00071">gd32f1x0_it.c:71</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a6ad7a5e3ee69cb6db6a6b9111ba898bc"><div class="ttname"><a href="gd32f1x0__it_8c.html#a6ad7a5e3ee69cb6db6a6b9111ba898bc">NMI_Handler</a></div><div class="ttdeci">void NMI_Handler(void)</div><div class="ttdoc">this function handles NMI exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00021">gd32f1x0_it.c:21</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a850cefb17a977292ae5eb4cafa9976c3"><div class="ttname"><a href="gd32f1x0__it_8c.html#a850cefb17a977292ae5eb4cafa9976c3">BusFault_Handler</a></div><div class="ttdeci">void BusFault_Handler(void)</div><div class="ttdoc">this function handles BusFault exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00043">gd32f1x0_it.c:43</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a94ca44d5889df2048bb8e52f7e2076e4"><div class="ttname"><a href="gd32f1x0__it_8c.html#a94ca44d5889df2048bb8e52f7e2076e4">TIMER13_IRQHandler</a></div><div class="ttdeci">void TIMER13_IRQHandler(void)</div><div class="ttdoc">this function handles TIMER13 TIMER_INT_UP interrupt request</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00124">gd32f1x0_it.c:124</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_aa521223328872dd7e4cd659fecbdfb84"><div class="ttname"><a href="gd32f1x0__it_8c.html#aa521223328872dd7e4cd659fecbdfb84">USART0_IRQHandler</a></div><div class="ttdeci">void USART0_IRQHandler(void)</div><div class="ttdoc">this function handles USART RBNE interrupt request</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00092">gd32f1x0_it.c:92</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_ab5e09814056d617c521549e542639b7e"><div class="ttname"><a href="gd32f1x0__it_8c.html#ab5e09814056d617c521549e542639b7e">SysTick_Handler</a></div><div class="ttdeci">void SysTick_Handler(void)</div><div class="ttdoc">this function handles SysTick exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00077">gd32f1x0_it.c:77</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_abb5e2753d967e52e57ddb82924eb5cf7"><div class="ttname"><a href="gd32f1x0__it_8c.html#abb5e2753d967e52e57ddb82924eb5cf7">systick_counter</a></div><div class="ttdeci">static unsigned char systick_counter</div><div class="ttdoc">systick interrupt count variable is used to realize the encoder update function.</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00016">gd32f1x0_it.c:16</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_adbdfb05858cc36fc520974df37ec3cb0"><div class="ttname"><a href="gd32f1x0__it_8c.html#adbdfb05858cc36fc520974df37ec3cb0">DebugMon_Handler</a></div><div class="ttdeci">void DebugMon_Handler(void)</div><div class="ttdoc">this function handles DebugMon exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00065">gd32f1x0_it.c:65</a></div></div>
<div class="ttc" id="agd32f1x0__it_8h_html"><div class="ttname"><a href="gd32f1x0__it_8h.html">gd32f1x0_it.h</a></div><div class="ttdoc">gd32f1x0 interrupt handler function header file</div></div>
<div class="ttc" id="amain_8h_html"><div class="ttname"><a href="main_8h.html">main.h</a></div><div class="ttdoc">main function Header File</div></div>
<div class="ttc" id="apid_8c_html_a2c7bcbec66fa40a2347b1cd253a5ae82"><div class="ttname"><a href="pid_8c.html#a2c7bcbec66fa40a2347b1cd253a5ae82">pid_control_mode_flag</a></div><div class="ttdeci">volatile unsigned char pid_control_mode_flag</div><div class="ttdoc">flag variable of PID closed loop mode</div><div class="ttdef"><b>Definition:</b> <a href="pid_8c_source.html#l00020">pid.c:20</a></div></div>
<div class="ttc" id="apid_8c_html_aaa8f5bad87ffc78a20f06863ab6bad5c"><div class="ttname"><a href="pid_8c.html#aaa8f5bad87ffc78a20f06863ab6bad5c">angle_pid_handler</a></div><div class="ttdeci">volatile PID_Structure_t angle_pid_handler</div><div class="ttdoc">algorithm handler of PID angle loop</div><div class="ttdef"><b>Definition:</b> <a href="pid_8c_source.html#l00028">pid.c:28</a></div></div>
<div class="ttc" id="apid_8c_html_ab051c8f4a730b934b146f330514efd95"><div class="ttname"><a href="pid_8c.html#ab051c8f4a730b934b146f330514efd95">speed_pid_handler</a></div><div class="ttdeci">volatile PID_Structure_t speed_pid_handler</div><div class="ttdoc">algorithm handler of PID speed loop</div><div class="ttdef"><b>Definition:</b> <a href="pid_8c_source.html#l00024">pid.c:24</a></div></div>
<div class="ttc" id="apid_8c_html_abe6a9dce63d0eaad5a10d4c8c5ffcd07"><div class="ttname"><a href="pid_8c.html#abe6a9dce63d0eaad5a10d4c8c5ffcd07">pid_calculate_result</a></div><div class="ttdeci">float pid_calculate_result(PID_Structure_t *pid_handler, float collect)</div><div class="ttdoc">calculate result using sampling value</div><div class="ttdef"><b>Definition:</b> <a href="pid_8c_source.html#l00061">pid.c:61</a></div></div>
<div class="ttc" id="apid_8h_html_a7dad3a985101eaec7ac078f43747c928"><div class="ttname"><a href="pid_8h.html#a7dad3a985101eaec7ac078f43747c928">ANGLE_LOOP_CONTROL</a></div><div class="ttdeci">#define ANGLE_LOOP_CONTROL</div><div class="ttdoc">angle loop control mode</div><div class="ttdef"><b>Definition:</b> <a href="pid_8h_source.html#l00018">pid.h:18</a></div></div>
<div class="ttc" id="astruct_f_o_c___structure__t_html_a483644b553c2be32ffbaf641f23c6cea"><div class="ttname"><a href="struct_f_o_c___structure__t.html#a483644b553c2be32ffbaf641f23c6cea">FOC_Structure_t::user_expect</a></div><div class="ttdeci">float user_expect</div><div class="ttdoc">user expect value of miniFOC</div><div class="ttdef"><b>Definition:</b> <a href="foc_8h_source.html#l00020">foc.h:20</a></div></div>
<div class="ttc" id="astruct_f_o_c___structure__t_html_af32f899f7a231c9df64a594c7b13bfa4"><div class="ttname"><a href="struct_f_o_c___structure__t.html#af32f899f7a231c9df64a594c7b13bfa4">FOC_Structure_t::rotate_speed</a></div><div class="ttdeci">float rotate_speed</div><div class="ttdoc">motor rotate speed calculate from timer</div><div class="ttdef"><b>Definition:</b> <a href="foc_8h_source.html#l00019">foc.h:19</a></div></div>
<div class="ttc" id="astruct_f_o_c___structure__t_html_af832998676bd09b4198a7a7274072766"><div class="ttname"><a href="struct_f_o_c___structure__t.html#af832998676bd09b4198a7a7274072766">FOC_Structure_t::mechanical_angle</a></div><div class="ttdeci">float mechanical_angle</div><div class="ttdoc">mechanical angle read form encoder</div><div class="ttdef"><b>Definition:</b> <a href="foc_8h_source.html#l00018">foc.h:18</a></div></div>
<div class="ttc" id="astruct_p_i_d___structure__t_html"><div class="ttname"><a href="struct_p_i_d___structure__t.html">PID_Structure_t</a></div><div class="ttdoc">structure of PID algorithm</div><div class="ttdef"><b>Definition:</b> <a href="pid_8h_source.html#l00024">pid.h:24</a></div></div>
<div class="ttc" id="astruct_p_i_d___structure__t_html_ad0e13a810b1a4602c1ce625f9877cbf5"><div class="ttname"><a href="struct_p_i_d___structure__t.html#ad0e13a810b1a4602c1ce625f9877cbf5">PID_Structure_t::expect</a></div><div class="ttdeci">float expect</div><div class="ttdoc">user expectations in PID</div><div class="ttdef"><b>Definition:</b> <a href="pid_8h_source.html#l00029">pid.h:29</a></div></div>
<div class="ttc" id="asystem_8c_html_a713199ab95f480628d6658708ed8de8b"><div class="ttname"><a href="system_8c.html#a713199ab95f480628d6658708ed8de8b">delay_decrement</a></div><div class="ttdeci">void delay_decrement(void)</div><div class="ttdoc">delay counter decrement function, called by systick handler</div><div class="ttdef"><b>Definition:</b> <a href="system_8c_source.html#l00038">system.c:38</a></div></div>
<div class="ttc" id="atimer_8c_html_ab3614c1dcfba485b2e299839d9c189e4"><div class="ttname"><a href="timer_8c.html#ab3614c1dcfba485b2e299839d9c189e4">update_pwm_dutycycle</a></div><div class="ttdeci">void update_pwm_dutycycle(float ch0, float ch1, float ch2)</div><div class="ttdoc">update timer1 ch0 1 2 duty-cycle</div><div class="ttdef"><b>Definition:</b> <a href="timer_8c_source.html#l00020">timer.c:20</a></div></div>
<div class="ttc" id="auart_8c_html_a8b1fe807c1672229711abeb195185046"><div class="ttname"><a href="uart_8c.html#a8b1fe807c1672229711abeb195185046">mdtp_receive_handler</a></div><div class="ttdeci">void mdtp_receive_handler(unsigned char data)</div><div class="ttdoc">medium capacity data transmission protocol unpacking handler</div><div class="ttdef"><b>Definition:</b> <a href="uart_8c_source.html#l00036">uart.c:36</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4
</small></address>
</body>
</html>
